 <?php
	print("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> \n");
	print("<datasources>\n");
	if(!isset($_GET["CID"]))
	{
		print("</datasources>\n");
		return;
	}
	
    $db = mysql_connect("localhost","root","root");
    mysql_select_db("brainway");
    
	$query = "select datasource_name.DID DID, datasource_name.name name, datasource_discription.discription discription
				from datasource_name left join datasource_discription on datasource_name.DID = datasource_discription.DID
				where datasource_name.CID=".$_GET["CID"];
	
	$result = mysql_query($query);
	$num_rows = mysql_num_rows($result);
	
	for( $row_num=0; $row_num < $num_rows; $row_num++)
	{
        $row = mysql_fetch_array($result);
        print("  <datasource>\n");
        print("    <DID>".$row["DID"]."</DID> \n");
        print("    <name>".$row["name"]."</name> \n");
	print("	   <CID>".$_GET["CID"]."</CID> \n");
        print("    <discription>".$row["discription"]."</discription>");
        print("  </datasource>\n");
	}
	print("</datasources>\n");
?>